package com.zhongxiangspace.tools;

import java.util.UUID;

/**
 * 生成id
 * 
 * @author Administrator
 *
 */
public class GeneratePKID {
	public static int SEED = 1;

	/**
	 * 获取uuid
	 * @return
	 */
	public static String getUUID() {
		String uuid = UUID.randomUUID().toString();
		return uuid.replaceAll("-", "");
	}

	public static String GeneratePKID() {
		if (SEED < 999) {
			SEED += 1;
		} else {
			SEED = 1;
		}
		String textSeed = String.valueOf(SEED);
		while (textSeed.length() < 3) {
			textSeed = String.format("%03d", SEED);
		}
		String textTotalSecs = DateUtil.getFormateDate("yyyyMMddHHmmss");
		if (textTotalSecs.length() < 17) {
			textTotalSecs = String.valueOf(textTotalSecs);
		}
		return textTotalSecs + textSeed;
	}
}
